#include<bits/stdc++.h>

using namespace std;

bool st(char* pre,char* str)
{
	while(1)
	{
		if(*str== '\0')return true;
		if(*pre == * str)
		{
			pre++;
			str++;
		}
		else
		return false;
		
	}
	return false;
}
int main()
{
	string A,B;
	cin>>A;
	cin>>B;
	int cot = 0;
	char* pre = &A[0],*cur = &B[0];
	while(*pre != '\0')
	{
		if(st(pre,cur))
		{
			cot++;
		}
		pre++;
	}
	cout<<cot;
}
